package com.demo.fingerprintdemo;

import java.lang.ref.WeakReference;

import android.os.Handler;
import android.os.Message;

interface IOnHandlerMessage {
	public void handleMessage(Message msg);
}

public class WeakRefHandler extends Handler {
	private WeakReference<IOnHandlerMessage> mHandlerActivity;

	public WeakRefHandler(IOnHandlerMessage activity) {
		mHandlerActivity = new WeakReference<IOnHandlerMessage>(activity);
	}

	@Override
	public void handleMessage(Message msg) {
		super.handleMessage(msg);

		IOnHandlerMessage activity = (IOnHandlerMessage)mHandlerActivity.get();
		if (null != activity) {
			activity.handleMessage(msg);
		}
	}
}
